# Remove Certificate from Windows Certificate Store
param(
    [Parameter(Mandatory=$true)]
    [string]$Thumbprint,

    [Parameter(Mandatory=$false)]
    [string]$StoreLocation = "LocalMachine",

    [Parameter(Mandatory=$false)]
    [string]$StoreName = "My"
)

try {
    $certPath = "Cert:\$StoreLocation\$StoreName\$Thumbprint"

    $cert = Get-Item -Path $certPath -ErrorAction SilentlyContinue

    if ($cert) {
        Remove-Item -Path $certPath -Force
        Write-Output "Certificate removed: $Thumbprint"
    } else {
        Write-Warning "Certificate not found: $Thumbprint"
    }

    exit 0

} catch {
    Write-Error $_.Exception.Message
    exit 1
}
